const copyElements = document.querySelectorAll('.copy');
copyElements.forEach(element => {
  element.addEventListener('click', () => {
    const textarea = document.createElement('textarea');
    textarea.value = element.getAttribute('src');
    document.body.appendChild(textarea);
    textarea.select();
    document.execCommand('copy');
    element.innerText = '已复制';
    document.body.removeChild(textarea);
  });
});

document.querySelectorAll('a').forEach(link => {
  const isExternal = link.hostname !== window.location.hostname;
  if (isExternal) {
    link.setAttribute('target', '_blank');
  }
});